/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model.Entity.SIS;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author user12
 */
@Entity
@Table(name = "SIS_FACULTIES")
@NamedQueries({
    @NamedQuery(name = "Faculty.findAll", query = "SELECT s FROM Faculty s"),
    @NamedQuery(name = "Faculty.findByFacultyNo", query = "SELECT s FROM Faculty s WHERE s.facultyNo = :facultyNo"),
    @NamedQuery(name = "Faculty.findByFacultyName", query = "SELECT s FROM Faculty s WHERE s.facultyName = :facultyName"),
    @NamedQuery(name = "Faculty.findByFacultyNameS", query = "SELECT s FROM Faculty s WHERE s.facultyNameS = :facultyNameS"),
    @NamedQuery(name = "Faculty.findByEntryDate", query = "SELECT s FROM Faculty s WHERE s.entryDate = :entryDate"),
    @NamedQuery(name = "Faculty.findByTerminal", query = "SELECT s FROM Faculty s WHERE s.terminal = :terminal"),
    @NamedQuery(name = "Faculty.findByOsUser", query = "SELECT s FROM Faculty s WHERE s.osUser = :osUser")})
public class Faculty implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "FACULTY_NO")
    private Integer facultyNo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 60)
    @Column(name = "FACULTY_NAME")
    private String facultyName;
    @Size(max = 60)
    @Column(name = "FACULTY_NAME_S")
    private String facultyNameS;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ENTRY_DATE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date entryDate;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    private String terminal;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "OS_USER")
    private String osUser;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "faculty")
    private List<Course> coursesList;
    @JoinColumn(name = "INSTRUCTOR_ID", referencedColumnName = "INSTRUCTOR_ID")
    @ManyToOne
    private Instructor instructorId;

    public Faculty() {
    }

    public Faculty(Integer facultyNo) {
        this.facultyNo = facultyNo;
    }

    public Faculty(Integer facultyNo, String facultyName, Date entryDate, String terminal, String osUser) {
        this.facultyNo = facultyNo;
        this.facultyName = facultyName;
        this.entryDate = entryDate;
        this.terminal = terminal;
        this.osUser = osUser;
    }

    public Integer getFacultyNo() {
        return facultyNo;
    }

    public void setFacultyNo(Integer facultyNo) {
        this.facultyNo = facultyNo;
    }

    public String getFacultyName() {
        return facultyName;
    }

    public void setFacultyName(String facultyName) {
        this.facultyName = facultyName;
    }

    public String getFacultyNameS() {
        return facultyNameS;
    }

    public void setFacultyNameS(String facultyNameS) {
        this.facultyNameS = facultyNameS;
    }

    public Date getEntryDate() {
        return entryDate;
    }

    public void setEntryDate(Date entryDate) {
        this.entryDate = entryDate;
    }

    public String getTerminal() {
        return terminal;
    }

    public void setTerminal(String terminal) {
        this.terminal = terminal;
    }

    public String getOsUser() {
        return osUser;
    }

    public void setOsUser(String osUser) {
        this.osUser = osUser;
    }

    public List<Course> getCoursesList() {
        return coursesList;
    }

    public void setCoursesList(List<Course> coursesList) {
        this.coursesList = coursesList;
    }


	public Instructor getInstructorId() {
		return instructorId;
	}

	public void setInstructorId(Instructor instructorId) {
		this.instructorId = instructorId;
	}

	@Override
    public int hashCode() {
        int hash = 0;
        hash += (facultyNo != null ? facultyNo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Faculty)) {
            return false;
        }
        Faculty other = (Faculty) object;
        if ((this.facultyNo == null && other.facultyNo != null) || (this.facultyNo != null && !this.facultyNo.equals(other.facultyNo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.SisFaculties[ facultyNo=" + facultyNo + " ]";
    }
    
}
